﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true"
    CodeFile="ControllAction_Add.aspx.cs" Inherits="Admin_Views_ActionRole_ControllAction_Add" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <script type="text/javascript">
        var isDialogPage = (frameElement != null); //本页面是否是对话框打开的

        if (isDialogPage) {

            // api.opener 为载加lhgdialog.min.js文件的页面的window对象
            // D 为载加lhgdialog.min.js文件的页面的document对象
            //不是lhgdialog打开
            if (typeof (frameElement.api) == "undefined") {
                isDialogPage = false;
            } else {
                var api = frameElement.api, W = api.opener, D = W.document;
            }
        }

        $(function () {

            dark.form({
                appendTo: $(".form2"),
                title: "添加权限",
                data: {},
                width: 550,
                items: [
				{ id: "ActionName", label: "名称", type: "textbox", required: true, width: 180 },
                { id: "ActionDescription", label: "描述", type: "textbox", required: true, width: 250 },
                { id: "ClassName", label: "类名", type: "textbox", required: true, width: 180 },
                { id: "FunctionName", label: "方法名", type: "textbox", required: true, width: 180 },
                { id: "ParentID", label: "所属", type: "comboBox", required: true, width: 180, value: 0, data: DarkCRM.Models.ControllerAction.GetControllerActionName().Data },

                { id: "submit", label: "添加", type: "submit", iconCls: "icon-save", url: "",
                    onClick: function (isValid, formData) {
                        DarkCRM.Models.ControllerAction.CreateControllerAction(formData, { success: function (result) {                            
                            if (result.ErrorCode == 0) {
                                dark.dialog.successAlter("添加成功!", function () {
                                    if (isDialogPage) {
                                        W.reload(); //刷新parent的grid控件
                                        api.close(); //关闭自己对话框
                                    }
                                });
                            } else {
                                dark.dialog.error(result.Description);
                            }
                        }
                        });

                    },
                    success: function (isValid, data) {

                    },
                    onLoadError: function () {
                    }
                }
                ]
            });
        });

    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="form2">
    </div>
</asp:Content>
